home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / share / ewl / examples / ewl_table_test.c < prev    next >
C/C++ Source or Header  |  2006-01-09  |  5KB  |  157 lines

  1. #include "ewl_test.h"
  2.  
  3. static Ewl_Widget *table_button = NULL;
  4.  
  5. static void
  6. __destroy_table_test_window(Ewl_Widget * w, void *ev_data __UNUSED__,
  7.                     void *user_data __UNUSED__)
  8. {
  9.     ewl_widget_destroy(w);
  10.     ewl_callback_append(table_button, EWL_CALLBACK_CLICKED,
  11.                 __create_table_test_window, NULL);
  12. }
  13.  
  14. void
  15. __create_table_test_window(Ewl_Widget * w, void *ev_data __UNUSED__,
  16.                     void *user_data __UNUSED__)
  17. {
  18.     Ewl_Widget     *table_win;
  19.     Ewl_Widget     *table_box;
  20.     Ewl_Widget     *table;
  21.     Ewl_Widget     *button[10];
  22.     char           *headers[4];
  23.     char           *one = "one";
  24.     char           *two = "two";
  25.     char           *three = "three";
  26.     char           *four = "four";
  27.  
  28.     table_button = w;
  29.  
  30.     table_win = ewl_window_new();
  31.     ewl_window_title_set(EWL_WINDOW(table_win), "Table Test");
  32.     ewl_window_name_set(EWL_WINDOW(table_win), "EWL Test Application");
  33.     ewl_window_class_set(EWL_WINDOW(table_win), "EFL Test Application");
  34.  
  35.     if (w) {
  36.         ewl_callback_del(w, EWL_CALLBACK_CLICKED, 
  37.                     __create_table_test_window);
  38.         ewl_callback_append(table_win, EWL_CALLBACK_DELETE_WINDOW,
  39.                     __destroy_table_test_window, NULL);
  40.     } else 
  41.         ewl_callback_append(table_win, EWL_CALLBACK_DELETE_WINDOW,
  42.                     __close_main_window, NULL);
  43.     ewl_widget_show(table_win);
  44.  
  45.     /*
  46.      * Create the main box for holding the widgets
  47.      */
  48.     table_box = ewl_vbox_new();
  49.     ewl_object_fill_policy_set(EWL_OBJECT(table_box), EWL_FLAG_FILL_FILL);
  50.     ewl_container_child_append(EWL_CONTAINER(table_win), table_box);
  51.     ewl_theme_data_str_set(table_box,
  52.                    "/appearance/box/vertical/base/visible", "no");
  53.     ewl_widget_show(table_box);
  54.  
  55.  
  56.     headers[0] = one;
  57.     headers[1] = two;
  58.     headers[2] = three;
  59.     headers[3] = four;
  60.  
  61.     table = ewl_table_new(4, 5, headers);
  62.     ewl_container_child_append(EWL_CONTAINER(table_box), table);
  63.     ewl_widget_show(table);
  64.  
  65.     
  66.  
  67.     button[0] = ewl_button_new();
  68.     ewl_button_label_set(EWL_BUTTON(button[0]), "FIRST");
  69.     ewl_table_add(EWL_TABLE(table), button[0], 3, 4, 2, 3);
  70.     ewl_widget_show(button[0]);
  71.  
  72. /*
  73.     button[1] = ewl_button_new();
  74.     ewl_button_label_set(EWL_BUTTON(button[1]), NULL);
  75.     ewl_table_attach(EWL_TABLE(table), button[1], 1, 1, 2, 2);
  76.     ewl_object_set_custom_size(EWL_OBJECT(button[1]), 100, 20);
  77.     ewl_object_fill_policy_set(EWL_OBJECT(button[1]),
  78.                    EWL_FLAG_FILL_NORMAL);
  79.     ewl_widget_realize(button[1]);
  80.  
  81.     button[2] = ewl_button_new();
  82.     ewl_button_label_set(EWL_BUTTON(button[2]), NULL);
  83.     ewl_table_attach(EWL_TABLE(table), button[2], 1, 1, 3, 3);
  84.     ewl_object_set_custom_size(EWL_OBJECT(button[2]), 100, 20);
  85.     ewl_object_fill_policy_set(EWL_OBJECT(button[2]),
  86.                    EWL_FLAG_FILL_NORMAL);
  87.     ewl_widget_show(button[2]);
  88.  
  89.  
  90.     button[3] = ewl_button_new();
  91.     ewl_button_label_set(EWL_BUTTON(button[3]), NULL);
  92.     ewl_object_set_custom_height(EWL_OBJECT(button[3]), 20);
  93.     ewl_table_attach(EWL_TABLE(table), button[3], 2, 2, 1, 1);
  94.     ewl_widget_show(button[3]);
  95.  
  96.     button[4] = ewl_button_new();
  97.     ewl_button_label_set(EWL_BUTTON(button[4]), NULL);
  98.     ewl_object_set_custom_height(EWL_OBJECT(button[4]), 20);
  99.     ewl_table_attach(EWL_TABLE(table), button[4], 2, 2, 2, 2);
  100.     ewl_widget_show(button[4]);
  101.  
  102.     button[5] = ewl_button_new();
  103.     ewl_button_label_set(EWL_BUTTON(button[5]), NULL);
  104.     ewl_object_set_custom_height(EWL_OBJECT(button[5]), 20);
  105.     ewl_table_attach(EWL_TABLE(table), button[5], 2, 2, 3, 3);
  106.     ewl_widget_realize(button[5]);
  107.  
  108.     button[6] = ewl_button_new();
  109.     ewl_button_label_set(EWL_BUTTON(button[6]), NULL);
  110.     ewl_table_attach(EWL_TABLE(table), button[6], 2, 2, 4, 4);
  111.     ewl_object_set_custom_size(EWL_OBJECT(button[6]), 100, 20);
  112.     ewl_object_fill_policy_set(EWL_OBJECT(button[6]),
  113.                    EWL_FLAG_FILL_NORMAL);
  114.     ewl_widget_realize(button[6]);
  115.  
  116.     button[7] = ewl_button_new();
  117.     ewl_button_label_set(EWL_BUTTON(button[7]), NULL);
  118.     ewl_table_attach(EWL_TABLE(table), button[7], 3, 3, 4, 4);
  119.     ewl_object_set_custom_size(EWL_OBJECT(button[7]), 100, 20);
  120.     ewl_object_fill_policy_set(EWL_OBJECT(button[7]),
  121.                    EWL_FLAG_FILL_NORMAL);
  122.     ewl_widget_realize(button[7]);
  123.  
  124.     button[8] = ewl_button_new();
  125.     ewl_button_label_set(EWL_BUTTON(button[8]), NULL);
  126.     ewl_object_set_custom_height(EWL_OBJECT(button[8]), 20);
  127.     ewl_table_attach(EWL_TABLE(table), button[8], 3, 3, 2, 2);
  128.     ewl_widget_realize(button[8]);
  129.  
  130.     button[9] = ewl_button_new();
  131.     ewl_button_label_set(EWL_BUTTON(button[9]), NULL);
  132.     ewl_object_set_custom_height(EWL_OBJECT(button[9]), 20);
  133.     ewl_table_attach(EWL_TABLE(table), button[9], 2, 3, 5, 5);
  134.     ewl_widget_realize(button[9]);
  135.  
  136.     button[10] = ewl_button_new();
  137.     ewl_button_label_set(EWL_BUTTON(button[10]), NULL);
  138.     ewl_object_set_custom_size(EWL_OBJECT(button[10]), 100, 20);
  139.     ewl_object_fill_policy_set(EWL_OBJECT(button[10]),
  140.                    EWL_FLAG_FILL_NORMAL);
  141.     ewl_table_attach(EWL_TABLE(table), button[10], 4, 4, 4, 4);
  142.     ewl_widget_realize(button[10]);
  143.  
  144.     button[11] = ewl_button_new();
  145.     ewl_button_label_set(EWL_BUTTON(button[11]), NULL);
  146.     ewl_object_set_custom_size(EWL_OBJECT(button[11]), 100, 20);
  147.     ewl_object_fill_policy_set(EWL_OBJECT(button[11]),
  148.                    EWL_FLAG_FILL_NORMAL);
  149.  
  150.     ewl_table_attach(EWL_TABLE(table), button[11], 4, 4, 5, 5);
  151.     ewl_widget_realize(button[11]);
  152. */
  153.  
  154.     ewl_widget_configure(table);
  155. }
  156.  
  157.